import java.util.Scanner;

public class H {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long nCasos = in.nextLong();
		in.nextLine();
		for (long casos = 0; casos < nCasos; casos++) {
			String carretera = in.nextLine();
			int i = 0;
			int numTuneles = 0;
			
			while (i < carretera.length()) {
				if (carretera.charAt(i) == '.') {
					numTuneles++;
					i += 3;
				} else {
					i++;
				}
			}
			System.out.println(numTuneles);
		}
	}
}
